const Sequelize = require('sequelize')
const db = require('../db.js')
//把case表的字段映射成对象的属性,封装成Case对象
const CaseList = db.define(
  'CaseList',
  {
    id: { type: Sequelize.INTEGER, primaryKey: true, allowNull: false, autoIncrement: true },
    img: { type: Sequelize.STRING, allowNull: false },
    name: { type: Sequelize.STRING, allowNull: false },
    house_type: { type: Sequelize.STRING, allowNull: false },
    fit_type: { type: Sequelize.STRING, allowNull: false },
    area: { type: Sequelize.INTEGER, allowNull: false },
    price: { type: Sequelize.INTEGER, allowNull: false },
    views: { type: Sequelize.INTEGER, allowNull: false },
    created_at: { type: Sequelize.STRING },
    updated_at: { type: Sequelize.STRING },
  },
  {
    //是否支持驼峰命名
    underscored: true,
    //Case对象，对应的数据库表
    tableName: 'caselist',
  }
)
module.exports = CaseList
